package com.eling.elcms.travel.webapp.controller;

import com.eling.elcms.core.dao.hibernate.search.SearchCondition;
import com.eling.elcms.core.webapp.controller.BaseFormController;
import com.eling.elcms.core.webapp.controller.Msg;
import com.eling.elcms.core.webapp.spring.ModelFilling;
import com.eling.elcms.travel.model.CheckOutDeal;
import com.eling.elcms.travel.model.CheckOutSetlConfirm;
import com.eling.elcms.travel.service.ICheckOutSetlConfirmManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class CheckOutSetlConfirmController extends BaseFormController{

	@Autowired
	private ICheckOutSetlConfirmManager checkOutSetlConfManager;
	
	@RequestMapping("/api/checkoutsetlconfirm/save")
    @ResponseBody
	public CheckOutSetlConfirm save(@ModelAttribute@ModelFilling CheckOutSetlConfirm cond){
		return checkOutSetlConfManager.save(cond);
	}
	
	@RequestMapping("/api/checkoutsetlconfirm/{pkCheckOutSetlConfirm}/delete")
	@ResponseBody
	public Msg delete(@PathVariable Long pkCheckOutSetlConfirm){
		checkOutSetlConfManager.remove(pkCheckOutSetlConfirm);
		return new Msg("删除成功");
	}
	
	@RequestMapping("/api/checkoutsetlconfirm/query")
    @ResponseBody
	public List<CheckOutSetlConfirm> query(@ModelAttribute CheckOutSetlConfirm cond){
		return checkOutSetlConfManager.query(cond);
	}
	
	@RequestMapping("/api/checkoutsetlconfirm/search*")
	@ResponseBody
	public List<CheckOutSetlConfirm> search(@ModelAttribute SearchCondition sc,@ModelAttribute CheckOutSetlConfirm cond){
		sc.setQueryCondition(cond);
		return checkOutSetlConfManager.search(sc);
	}
	
	/**
	 * 散客退房结算确认
	 * @param cond
	 * @return
	 * @author zhoulin
	 */
	@RequestMapping("/api/checkoutsetlconfirm/saveconfirm")
    @ResponseBody
	public CheckOutSetlConfirm saveConfirm(@ModelAttribute CheckOutSetlConfirm cond){
		return checkOutSetlConfManager.saveConfirm(cond);
	}
	
	
	/** 散客销账*/
	@RequestMapping("/api/checkoutsetlconfirm/changeoncredit")
	@ResponseBody
	public CheckOutDeal changeOnCredit(@ModelAttribute CheckOutDeal cond){
		return checkOutSetlConfManager.changeOnCredit(cond);
	}
	
	
	
}
